package com.itheima.day05_多态和内部类.develophomework02.homework01;

abstract class Human {
    private String name;
    private int age;
    private String sex;

    public abstract void speak();
    public abstract void run();

    public void getInfo(){
        System.out.println(getName()+"..."+getAge()+"..."+getSex());
    }

    public Human() {
    }

    public Human(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
}

public class Test{
    public static void main(String[] args) {
        Man m = new Man("张三",23,"男");
        m.run();
        m.speak();
        m.getInfo();
        Human h =new Woman();
        Woman w = (Woman)h;
        w.womanSpeak();
    }
}

class Man extends Human{

    public Man() {
    }

    public Man(String name, int age, String sex) {
        super(name, age, sex);
    }

    @Override
    public void speak() {
        System.out.println("男人大嗓门");
    }

    @Override
    public void run() {
        System.out.println("男人跑的快");
    }

}

class Woman extends Human{

    public Woman() {
    }

    public Woman(String name, int age, String sex) {
        super(name, age, sex);
    }


    public void womanSpeak() {
        System.out.println("女人小声说话");
    }

    @Override
    public void speak() {
        System.out.println("说话");
    }

    @Override
    public void run() {
        System.out.println("女人跑得慢");
    }
}